package com.neusoft.news.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.swing.JOptionPane;

import com.neusoft.news.bean.News;
import com.neusoft.news.service.NewsService;

@WebServlet("/result")
public class ExamineResultServlet extends BaseServlet {
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		this.doPost(req, resp);
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		super.doPost(req, resp);
		NewsService newsService = new NewsService();
		String result = req.getParameter("res");
		String newid = req.getParameter("nid");
		News news = new News();
		news.setNews_id(newid);
		news.setNews_state(result);
		newsService.updateNewsState(news);
		req.getRequestDispatcher("/examine").forward(req, resp);
	}
}
